package com.rn.gypsophila.rabbitmq.web;

import com.rn.gypsophila.model.GlobalRet;
import com.rn.gypsophila.mvc.BaseController;
import com.rn.gypsophila.rabbitmq.EventMessage;
import com.rn.gypsophila.rabbitmq.mq.TxMessageProducer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description: 测试
 *
 * @author 然诺
 * @date 2020/05/09
 */
@Api(tags = {"测试服务接口"})
@RestController
@AllArgsConstructor
@RequestMapping("test")
public class TestController extends BaseController {

	private final TxMessageProducer txMessageProducer;

	@ApiOperation(value = "分布式事务测试")
	@GetMapping("/tx")
	public GlobalRet send() {
		txMessageProducer.send(new EventMessage().setOrderId(1L).setGoodsId(11L).setGoodsNum(111));
		return success();
	}

}
